{* $Id$ *}
{include_core file="admin/lib/header.html" title="任务执行列表 - {$job_name}"}
<div class="page-header border-bottom clearfix">
    <h2 class="left">任务执行列表{if $job_name} - {$job_name}{/if}</h2>
    <a href='{AnUrl("topic/admin/export?{URLTracker::set("export", "1")}")}' class="btn btn-success btn-sm
    right">导出EXCEL</a>
    <a href='{AnUrl("topic/admin/download?{URLTracker::parse("download=1&status=-1")}")}' class="btn btn-success btn-sm
    right">图片打包下载</a>
</div>
<div class="search-form js_advancedForm">
    <form action='{AnUrl("topic/admin")}' method="get" class="js_focusSearchForm">
        <p>
            <label for="dealer_name" class="search-f-label">合伙人姓名：</label>
            <input type="text" class="search-f-ipt1" style="height:20px" name="search_filter[dealer_name]"
                   value="{$search_filter.dealer_name}" id="dealer_name">
        </p>
        <p>
            <label for="dealer_mobile" class="search-f-label">合伙人手机号：</label>
            <input type="text" class="search-f-ipt1" style="height:20px" name="search_filter[dealer_mobile]"
                   value="{$search_filter.dealer_mobile}" id="dealer_mobile">
        </p>
        <p>
            <label class="search-f-label">上传时间：</label>
            <input type="text" class="search-f-ipt1 search-f-ipt2" name="search_filter[start_date]"
                   value="{$search_filter.start_date}" id="startDate">
            <span class="search-f-line"></span>
            <input type="text" class="search-f-ipt1 search-f-ipt2" name="search_filter[end_date]"
                   value="{$search_filter.end_date}" id="stopDate">
        </p>
        <p>
            <label class="search-f-label"></label>
            <button type="submit" class="btn btn-success btn-xs js_searchBtn">搜索</button>
        </p>
    </form>
</div>
<div class="list-table-filters">
    <p>
        <span class="label label-info">按任务</span>
        {foreach $job_list as $k => $v}
        <a href='{AnUrl("topic/admin?{URLTracker::set("job_id", $v.id)}")}' {if URLTracker::val("job_id") == $v.id}
        class="label label-primary" {else} class="label label-default" {/if}>{$v.name}</a>
        {foreachelse}
        <span class="label label-default">暂无</span>
        {/foreach}
    </p>
    <p>
        <span class="label label-info">按状态</span>
        <a href='{AnUrl("topic/admin?{URLTracker::set("status", "-1")}")}' {if URLTracker::val("status") == "-1"}
        class="label label-primary" {else} class="label label-default" {/if}>全部</a>
        {foreach topic_config::$COMPLY_STATUS as $k => $v}
        <a href='{AnUrl("topic/admin?{URLTracker::set("status", $k)}")}' {if URLTracker::val("status") == $k}
        class="label label-primary" {else} class="label label-default" {/if}>{$v}</a>
        {/foreach}
    </p>
</div>
<!--start:列表-->
{include_core file="admin/lib/pager.html"}
<table class="list-table">
    <thead>
    <tr>
        <th>序号</th>
        <th>门店名称</th>
        <th style="min-width:100px;">门店头图</th>
        <th style="min-width:300px;">照片</th>
        <th style="min-width:70px;">上传时间</th>
        <th>合伙人</th>
        <th>上传者</th>
        <th>上传备注</th>
        <th>状态</th>
        <th style="min-width:60px;">操作</th>
    </tr>
    </thead>
    <tbody>
    {foreach $job_comply_list as $k => $v}
    <tr id="dataList_{$v.id}" data-id="{$v.id}" data-status="{$v.status}">
        <td>{$v.id}</td>
        <td>
            {$v.store_info.title}
            {if $v.store_info.title_branch}
            - {$v.store_info.title_branch}
            {/if}
        </td>
        <td>
            {if $v.store_info.cover}
            <a href="{$v.store_info.cover}" target="_blank">
                <img width="100" height="80" src="{$v.store_info.cover}"/>
            </a>
            {/if}
        </td>
        <td class="js-verify-pics">
            {foreach $v.pics as $pic}
            <a href="{$pic}" target="_blank">
                <img width="100" height="80" src="{$pic}"/>
            </a>
            {/foreach}
        </td>
        <td>{$v.upload_time}</td>
        <td>
            {$v.dealer_info.realname}<br/>
            {$v.dealer_info.mobile}
        </td>
        <td>
            {$v.uploader_info.realname}<br/>
            {$v.uploader_info.mobile}
        </td>
        <td>{$v.extra}</td>
        <td>
            {if $v.status == 0}
            <span class="label label-default">未审核</span>
            {elseif $v.status == 1}
            <span class="label label-success">已通过</span>
            {elseif $v.status == 2}
            <span class="label label-danger">已驳回</span><br/>
            <p>驳回理由: </p>
            <p>{$v.reject_reason}</p>
            {/if}
        </td>
        <td class="js-confirm">
            {if $v.status == 0}
            <a data-action="reject" href="javascript:void(0)" class="btn btn-danger btn-xs"><i
                    class="icon-trash icon-white"></i>驳回</a><br/>
            <a data-action="accept" href="javascript:void(0)" class="btn btn-success btn-xs"><i
                    class="icon-trash icon-white"></i>通过</a>
            {elseif $v.status == 1}
            <a data-action="reject" href="javascript:void(0)" class="btn btn-danger btn-xs"><i
                    class="icon-trash icon-white"></i>驳回</a>
            {elseif $v.status == 2}
            <a data-action="accept" href="javascript:void(0)" class="btn btn-success btn-xs"><i
                    class="icon-trash icon-white"></i>通过</a>
            {/if}
        </td>
    </tr>
    {foreachelse}
    <tr>
        <td class="txtleft" colspan="11">暂无数据</td>
    </tr>
    {/foreach}
    </tbody>
</table>
{include_core file="admin/lib/pager.html"}
{include_core file="module/image_set_viewer_selector.html"}
<script>
    $('.js-verify-pics img, .js-confirm a[data-action="reject"], .js-confirm a[data-action="accept"]').on('click', function (e) {
        var el = $(this);
        var initStatus = 0;

        if (el.data('action') === 'reject') {
            initStatus = 2;
        }

        var wrap = $(this).closest('tr');
        //if(wrap.data('status') == 0){
        var _h = wrap.find('.js-verify-pics').image_set_viewer_selector({
            id: wrap.data('id'),
            acceptUrl: '{AnUrl("topic/admin/verify?action=accept")}',
            acceptCallback: function () {

            },
            rejectUrl: '{AnUrl("topic/admin/verify?action=reject")}',
            rejectCallback: function () {

            },
            initStatus: initStatus,
            status: wrap.data('status')
        });
        if (_h) {
            _h.show();
            return false;
        }
        //}
    });
</script>
<!--end:列表-->
{include_core file="admin/lib/footer.html"}